package cn.learn.designpattern.decorator.decorator;

/**
 * 装饰模式的具体构件，本来的业务逻辑
 *
 * @author huangyezhan
 * @date 2019年02月23日22:56
 */
public class ConcreteComponent implements Component {

    @Override
    public void sampleOperation() {
        System.out.println("很无奈，在走路...");
    }

}


/**
 * 具体装饰类A
 */
class ConcreteDecoratorA extends Decorator {

    public ConcreteDecoratorA(Component component) {
        super(component);
    }

    @Override
    public void sampleOperation() {
        System.out.println("加持了火车,飞奔在路上...");
        super.sampleOperation();
    }

}

/**
 * 具体装饰类B
 */
class ConcreteDecoratorB extends Decorator {
    public ConcreteDecoratorB(Component component) {
        super(component);
    }

    @Override
    public void sampleOperation() {
        System.out.println("加持了飞机,飘的很...");
        super.sampleOperation();
    }
}

